package com.jinhongone.pattern.behavior.command;

/**
 * @author jinho
 * @className OrderCommand
 * @description 订单命令类 （具体命令角色）
 * @date 2025/3/31 9:24
 */
public class OrderCommand implements Command{

    //接收者
    private SeniorChef seniorChef;

    private Order order;

    public OrderCommand(SeniorChef seniorChef, Order order) {
        this.seniorChef = seniorChef;
        this.order = order;
    }
    //命令的执行，由接收者实际完成命令
    @Override
    public void execute() {
        System.out.println("第" + order.getDiningTable() + "座客户的订单：");
        for (String foodName : order.getFoods().keySet()) {
            seniorChef.makeFood(order.getFoods().get(foodName),foodName);
        }
        System.out.println("第" + order.getDiningTable() + "座客户的订单制作完毕");
    }
}
